package MaxHeap;

/**
 * TOOD
 *
 * @author long
 * @date 2020-01-08 16:47
 */
public class PriorityQueue<E extends  Comparable<E>> implements Queue<E> {

    private MaxHeap<E> maxHeap;

    public PriorityQueue(){
        maxHeap=new MaxHeap<E>();
    }

    @Override
    public int getSize() {
        return maxHeap.size();
    }

    @Override
    public boolean isEmpty() {
        return maxHeap.isEmpty();
    }
    @Override
    public E getFront() {
        return maxHeap.findMax();
    }
    //入队操作
    @Override
    public void enqueue(E e) {
        maxHeap.add(e);
    }

    //出队
    @Override
    public E dequeue() {
        return maxHeap.extractMax();
    }


}
